package mianshi.singleton;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

/**
 * @author: Tangxz
 * @email: 1171702529@qq.com
 * @cate: 2020/11/16 17:01
 */
public enum EnumSingletor {
    INSTANCE;

    public EnumSingletor getInstance(){
        return INSTANCE;
    }
}
class Demo05{
    public static void main(String[] args) throws NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException {
        EnumSingletor instance = EnumSingletor.INSTANCE;
        EnumSingletor instance2 = EnumSingletor.INSTANCE;

        //没有无参构造器
//        Constructor<EnumSingletor> declaredConstructor = EnumSingletor.class.getDeclaredConstructor(null);
        Constructor<EnumSingletor> declaredConstructor = EnumSingletor.class.getDeclaredConstructor(String.class,int.class);
        declaredConstructor.setAccessible(true);
        EnumSingletor enumSingletor = declaredConstructor.newInstance();

    }
}
